var pics = {
  "data": [
      {"src": "/know/images/pic/1.jpg",   "alt": "紫霞仙子和至尊宝",},
      {"src": "/know/images/pic/2.jpg",   "alt": "紫霞仙子"}
   ]};

layui.use(['jquery','flow','layer'], function () {
	var $ = layui.jquery;
	// 流加载 图片
    var flow = layui.flow;
    var layer = layui.layer;

    var url=getRootPath()+'/action/image/list';
    flow.load({
    	elem: '.mixed-main', //流加载容器
    	isAuto: true,
    	end: '没有更多的图片了',
    	done: function(page,next) {
    		
    	    var count = pics.data.length-1;
    	    $.ajax({
      			url: url,
      			type:'post',
      			dataType: 'json',
      			success: function(data) {
      				var lis = [];
      				var count = data.count;
      			  layer.photos({
      			    photos: data.data
      			    ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
      			  });
      				$.each(data.data, function(index,item){
						var li='';
			    			if (index==7) {
			    				lis.push('<div class="mixed shadow animated zoomIn">'+
			    	                 '<div class="mixed-pic">'+
			    	                    '<a href="javascript:"><img src="/know/images/pic/0.jpg" alt="图片还在拍摄中" /></a>'+
				                    '</div>'+
				                    '<div class="mixed-info">图片还在拍摄中</div>'+
				                    '<div class="mixed-footer">'+
				                        '<a class="layui-btn layui-btn-small layui-btn-primary layui-btn-disabled"><i class="fa fa-eye fa-fw"></i>查看</a>'+
				                        '<a class="layui-btn layui-btn-small layui-btn-primary layui-btn-disabled"><i class="fa fa-download fa-fw"></i>下载</a>'+
				                    '</div>',
				                '</div>');
			    			} else {
				    			lis.push('<div class="mixed shadow animated zoomIn ">'+
				                    '<div class="mixed-pic" >'+
				                        '<a href="javascript:view('+item.img_id+')"><img layer-src="'+(getRootPath()+item.img_path)+'" src="'+(getRootPath()+item.img_path)+'" alt="'+item.img_alt+'" /></a>'+
				                    '</div>'+
				                    '<div class="mixed-info">'+item.img_alt+'</div>'+
				                    '<div class="mixed-footer">'+
				                        '<a class="layui-btn layui-btn-small layui-btn-primary" href="javascript:view('+item.img_id+')"><i class="fa fa-eye fa-fw"></i>查看</a>'+
				                        '<a class="layui-btn layui-btn-small layui-btn-primary" href="'+getRootPath()+'action/image/down?id='+item.img_id+'"><i class="fa fa-download fa-fw"></i>下载</a>'+
				                    '</div>',
				                '</div>');
			    			}
			    		
						});
				
					$('.blogroll').append(lis.join(''));
					next(lis.join(''), page < count/8);
				}      			
			});	

      			}
    	    });
 
   
});
//function view(start) {
//	pics.start = 1;
//	layer.photos({photos: pics });
//	layer.photos({
//		  photos: json/选择器,
//		  tab: function(pic, layero){
//		    console.log(pic) //当前图片的一些信息
//		  }
//		});
//}

    $(function () {
        $(".fa-paper-plane-o").parent().parent().addClass("layui-this");
    });